//package com.hzsai.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.web.servlet.LocaleResolver;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
//import org.springframework.web.servlet.i18n.SessionLocaleResolver;
//
//import java.util.Locale;
//
///**
// * hzsai
// * 2020/1/5 10:45
// * usage: config for i18n
// */
//public class I18nConfig implements WebMvcConfigurer {
//
//    private LocaleChangeInterceptor lci = null;
//
//    @Bean(name = "localeResolver")
//    public LocaleResolver initLocalResolver() {
//
//        SessionLocaleResolver slr = new SessionLocaleResolver();
//        slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
//        return slr;
//    }
//
//    @Bean
//    public LocaleChangeInterceptor localeChangeInterceptor() {
//        if (lci != null)
//            return lci;
//
//        lci = new LocaleChangeInterceptor();
//        lci.setParamName("language");
//
//        return lci;
//    }
//
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(localeChangeInterceptor());
//    }
//}
